import Vue from 'vue'
import VueRouter from 'vue-router'
// 加载组件
import Index from '../views/Index.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Index',
        component: Index
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue')
    },
    {
        path: '/detail/:id',
        name: 'Detail',
        props: true,
        component: () => import('../views/Detail.vue')
    }
]

const router = new VueRouter({
    routes
})
export default router
